package cn.itsource.org.domain;

import cn.itsource.domain.BaseTreeNode;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;


/**
 * 下拉多写:滚珠下拉
 * 格式化:ctrl+alt+L
 * 光标最前后移动 Home End
 *  部门实体类
 * 驼峰命名
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@Table(name = "t_department")
public class Department extends BaseTreeNode {


    //主键id
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    //编号
    @NotBlank(message = "部门编号不能为空")
    private String sn;

    //名称
    @NotBlank(message = "部门名称不能为空")
    private String name;

    //状态
    private Integer state;

    //经理id
    @Column(name = "manager_id")
    private Long managerId;

    //父部门id
    @Column(name = "parent_id")
    private Long parentId;

    //
    @Column(name = "dir_path")
    private String dirPath;

    //部门经理姓名
    @Transient
    private Employee manager;

    //上级部门姓名
    @Transient
    private Department parent;

    //
    @Transient
    private Long[] parentIds;


}
